﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace JNPF.Basics.Models.PlatForm.Dtos.Database
{
    public class DatabaseTableCrInput
    {
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public TableInfo tableInfo { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public List<TableFieldListItem> tableFieldList { get; set; }
    }

    public class TableInfo
    {
        /// <summary>
        /// 旧表名称
        /// </summary>
        [Required(ErrorMessage = "表名不能为空")]
        public string table { get; set; }
        /// <summary>
        /// 新表名称
        /// </summary>
        [Required(ErrorMessage = "表名不能为空")]
        public string newTable { get; set; }
        /// <summary>
        /// 表说明
        /// </summary>

        [Required(ErrorMessage = "表说明不能为空")]
        public string tableName { get; set; }

    }

    public class TableFieldListItem
    {
        /// <summary>
        /// 是否允许为空
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public int allowNull { get; set; }
        /// <summary>
        /// 长度
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public string dataLength { get; set; }
        /// <summary>
        /// 类型
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public string dataType { get; set; }
        /// <summary>
        /// 列名
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public string field { get; set; }
        /// <summary>
        /// 字段注释
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public string fieldName { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage = "必填")]
        public int index { get; set; }
        [Required(ErrorMessage = "必填")]
        public int primaryKey { get; set; }
    }
}
